package org.de.maeyer.unit;

/**
 * @author Peter De Maeyer
 */
public class PrefixingUnit extends MultiplyingUnit {

	private final String namePrefix;

	private final String symbolPrefix;

	public PrefixingUnit(String namePrefix, String symbolPrefix, double multiplier, Unit prefixedUnit) {
		super(multiplier, prefixedUnit);
		this.namePrefix = namePrefix;
		this.symbolPrefix = symbolPrefix;
	}

	@Override
	public String getName() {
		return new StringBuilder(15).append(namePrefix).append(multipliedUnit.getName()).toString();
	}

	@Override
	public String getSymbol() {
		return new StringBuilder(3).append(symbolPrefix).append(multipliedUnit.getSymbol()).toString();
	}
}
